package hr_project.hr.biz.Resumes;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import hr_project.hr.dao.IresumeDao;
import hr_project.hr.entity.Resumes;
import hr_project.hr.util.pagebean;

@Service
public class ResumesBizImp implements IResumesBiz {
	
	@Autowired
	private IresumeDao dao;
	
	public IresumeDao getDao() {
		return dao;
	}



	public void setDao(IresumeDao dao) {
		this.dao = dao;
	}



	@Override
	public pagebean getAll(int page, String re_name, String status) {
		// TODO Auto-generated method stub
		pagebean pb=new pagebean();
		pb.setCurrpage(page);
		pb.setPageSize(8);
		if(re_name!=null&&!re_name.equals("")){
			re_name="%"+re_name+"%";
			pb.setTotalRow(dao.getRowByanme(status, re_name));
			pb.setList(dao.selectResumes(re_name, status, page, pb.getPageSize()));
		}
		else{
			pb.setTotalRow(dao.getRow(status));
			pb.setList(dao.newResumes(status, page, pb.getPageSize()));
		}
		return pb;
	}



	@Override
	public Resumes getByid(long id) {
		// TODO Auto-generated method stub
		return dao.getByid(id);
	}



	@Override
	public void updatestatus(Resumes res) {
		// TODO Auto-generated method stub
		dao.updatestatus(res);
	}



	@Override
	public List<Resumes> getAll() {
		// TODO Auto-generated method stub
		return dao.getAll();
	}

	
}
